package work3_10;

import java.util.Scanner;

public class ArrayDemo01 {
    public static void main(String[] args) {
        //删除数组元素
        //1、定义一个静态数组
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        int[] arr1 = new int[arr.length - 1];
        //2、输入一个数组下标删除元素
        Scanner input = new Scanner(System.in);
        System.out.println("请输入元素下标：");
        int index = input.nextInt();
        for (int i = 0, start = 0; i < arr.length; i++) {
            if (i != index) {
                arr1[start++] = arr[i];
            }
        }
        for (int i = 0; i < arr1.length; i++) {
            System.out.print("   "+arr[i]);
        }
    }
}


